package com.ghp.interfas.controller;

import cn.hutool.http.HttpUtil;
import com.ghp.interfas.model.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ghp
 * @title
 * @description
 */
@RestController
@RequestMapping("/user")
public class UserController {


    /**
     * 返回用户输入的用户名，提供的一个测试接口
     */
    @PostMapping("/name")
    public String getUserName(@RequestBody User user) {
        return "你的用户名字是: " + user.getUsername();
    }

    /**
     * 获取当前用户的相关信息，
     */
    @PostMapping("/info")
    public String getUserInfo(){
        String url = "https://api.uomg.com/api/visitor.info?skey=随便写";
        return HttpUtil.get(url);
    }
}
